<template>
    <view class="content">
        <!-- <view class="fontSize">解决办法简述</view> -->
        <view class="uni-textarea">
            <textarea @input="bindTextAreaBlur" placeholder="在这里描述您遇到的问题" :value="value1" />
            </view>
       <button class="uni-button" @tap="bindAdd" >提交</button>
    </view>
</template>

<script>
import {
    request
} from "../../../comon/js/request.js";
export default {
    data() {
        return {
            value1: ""
        };
    },
    methods: {
        bindAdd() {
            let than = this
            if (than.value1 === "") {
                uni.showModal({
                    content: "请填写内容不能为空",
                    showCancel: false,
                    success: function (res) {}
                });
            } else {
                request({
                    url: "v1/feedback/add",
                    method: "POST",
                    data: {
                        opinion: than.value1
                    }
                }).then(res => {
                    console.log(res)
                    if (res.statusCode === 200) {
                        uni.showModal({
                            content: "反馈成功",
                            showCancel: false,
                            success: function (res) {
                                than.value1 = ""
                            }
                        });
                    }
                })
            }
        },
        bindTextAreaBlur: function (e) {
            let than = this
            console.log(e.detail.value);
            than.value1 = e.detail.value
            console.log(than.value1)

        }
    }
};
</script>

<style lang="less">
.uni-button {
    margin-top: 120rpx;
    width: 564rpx;
    background: #0c69a4;
    color: white;
}

.content {
    margin-left: 10rpx;
    margin-left: 20rpx;

    .fontSize {
        margin-top: 10rpx;
        font-size: 28rpx;
    }

    .uni-textarea {
        display: flex;
        margin-top: 30rpx;

        textarea {
            background: #eff0f3;
            width: 700rpx;
            height: 390rpx;
            border: 1rpx solid #eff0f3;
            font-size: 13px;
            letter-spacing: 0;
            line-height: 12px;
            padding-left: 20rpx;
            padding-top: 20rpx;
        }
    }

    .mini-btn {
        margin-top: 70rpx;
        margin-left: 450rpx;
        width: 250rpx;
        height: 80rpx;
        line-height: 80rpx;
        background: #169bd5;
    }
}
</style>
